<?php
error_reporting(15);
require_once("header.php");
require_once("functions.php");
?>
<p></p>
<FORM name="url-rewriting-tool" action="url-rewriting-tool.php" method="post">
<table cellpadding="9" cellspacing="0" border="0" width="98%" class="mytable">
<tr><td class="bodytext"><strong>Enter Dynamic URL:</strong></td></tr>
<tr><td class="bodytext"><INPUT maxLength="255" size="60" value="<?php if(isset($_REQUEST['seotools_url'])) echo $_REQUEST['seotools_url']; else echo 'http://'; ?>" name="seotools_url"></td></tr>
<tr><td class="bodytext"><INPUT name="submit" type="submit" value="Lookup" class="button"></td></tr>
<tr>
  <td class="footer">Eg.&nbsp;http://www.webpromotioner.com/product.php?categoryid=10&amp;productid=78 </td>
</tr>
</table>
</FORM>
<p>&nbsp;</p>
<?php

if (isset($_REQUEST['submit']) && isset($_REQUEST['seotools_url']) )
{

	$page = $_REQUEST['seotools_url'];
	$urlinfo = parse_url($page);
	$error = '';
	
	if (strpos($page,'?') === false) {
		$error = 'URL entered does not seem to be a dynamic URL';
	}
	

if ($error == '') {
?>
<table width="98%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td align="center" valign="top"><table width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="30" align="center" valign="middle" class="headingbar"><strong>Type 1 - Single Page URL</strong></td>
      </tr>
      <tr>
        <td class="bodytext">Generated URL:</td>
      </tr>
      <tr>
        <td class="footer"><?php echo type1_url($urlinfo).'.htm'; ?></td>
      </tr>
      <tr>
        <td height="35" align="left" valign="middle" class="footer">eg. <?php echo type1_url($urlinfo,true).'.htm'; ?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="bodytext">Create a .htaccess file with the code below</td>
      </tr>
      <tr>
        <td><textarea name="textarea" cols="80" rows="10"><?php 
		echo 'Options +FollowSymLinks
RewriteEngine on
';
		echo type_htaccess($page); ?></textarea></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="bodytext"><a href="download.php?type=1&fxid=<?php echo base64_encode($page); ?>" class="link1">Download Here</a></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td align="center" valign="top"><table width="95%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="30" align="center" valign="middle" class="headingbar"><strong>Type 2 - Directory Type URL</strong></td>
      </tr>
      <tr>
        <td class="bodytext">Generated URL:</td>
      </tr>
      <tr>
        <td class="footer"><?php echo type1_url($urlinfo,false,false); ?></td>
      </tr>
      <tr>
        <td height="35" align="left" valign="middle" class="footer">eg. <?php echo type1_url($urlinfo,true,false); ?></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="bodytext">Create a .htaccess file with the code below</td>
      </tr>
      <tr>
        <td><textarea name="textarea2" cols="80" rows="10"><?php 
		echo 'Options +FollowSymLinks
RewriteEngine on
';
		echo type_htaccess($page,true,true)."\n".type_htaccess($page,true); ?>
    </textarea></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td class="bodytext"><a href="download.php?fxid=<?php echo base64_encode($page); ?>" class="link1">Download Here</a></td>
      </tr>
    </table></td>
  </tr>
</table>
<?php
	} else {
		echo "<span class='error'>$error</span>";
	}
}
require_once("footer.php");

?>
